In [5]:
# Standard setup block for running Python code
from __future__ import division, print_function
import os
if os.path.split(os.getcwd())[-1] == "Lab notebooks":
os.chdir("../../")
print("Moved to experiment root directory")
from Modules.processing import *
from Modules.plotting import *
plt.style.use("Config/plotstyle.mplstyle")
%matplotlib inline
Started at 8 AM.
Removed turbine servo motor and guy wires. Going to pull out frame, measure backlash in lower flange connection, remove blades, and reinstall frame for measuring strut torque.
10:26 AM -- Blades are removed and frame is back in the water. Dye seems to have seeped out of blades 1 and 3, but not 2, which is strange.
Backlash in upper turbine shaft flange was due to the bolts loosening over the experiment, which is strange given the jam nuts on the lower part of the bolts. Backlash at outer diameter of circular flange was about 0.175 inches.
Retorqued bolts and jam nuts on turbine shaft flanges. Hub section and blade bolts remained tight.
11:30 AM -- Starting strut torque runs. Waiting 30 seconds between each.
12:00 PM -- Finished strut torque runs. Data looks reasonable--estimating a 0.02 drop in $C_P$ due to strut drag at 1.0 m/s, $\lambda = 3.1$. Backing up data.
2:17 PM -- Need to evacuate the building according to the Durham FD.
In [86]:
process_strut_torque(24, plot=True, verbose=True)
Out[86]:
In [88]:
tsr_ref = []
cp_loss = []
for n in range(26):
tsr, cp = process_strut_torque(n)
tsr_ref.append(tsr)
cp_loss.append(cp)
plt.plot(tsr_ref, cp_loss, "-o")
plt.xlabel("$\lambda$")
plt.ylabel("$C_P$ loss estimate")
plt.show()
In [87]:
def process_strut_torque(nrun, zero_torque=1.1, plot=False, covers=False, verbose=False):
"""Processes a single strut torque run."""
testplan = pd.read_csv("Config/Test plan/Strut-torque.csv", index_col="run")
ref_speed = testplan.ref_speed.iloc[nrun]
tsr_nom = testplan.tsr.iloc[nrun]
revs = testplan.revs.iloc[nrun]
rpm_nom = tsr_nom*ref_speed/R/(2*np.pi)*60
dur = revs/rpm_nom*60
if covers:
if verbose:
print("Processing strut torque with covers run", nrun)
nidata = loadhdf("Data/Raw/Strut-torque-covers/" + str(nrun) + "/nidata.h5")
else:
if verbose:
print("Processing strut torque run", nrun)
nidata = loadhdf("Data/Raw/Strut-torque/" + str(nrun) + "/nidata.h5")
# Compute RPM
time_ni = nidata["time"]
angle = nidata["turbine_angle"]
rpm_ni = fdiff.second_order_diff(angle, time_ni)/6.0
rpm_ni = ts.smooth(rpm_ni, 8)
t1, t2 = 9, dur
meanrpm, _ = ts.calcstats(rpm_ni, t1, t2, 2000)
torque = nidata["torque_trans"]
# torque = torque - np.mean(torque[:2000]) # 2000 samples of zero torque
meantorque, _ = ts.calcstats(torque, t1, t2, 2000)
tsr_ref = meanrpm/60.0*2*np.pi*R/ref_speed
if verbose:
print("Reference TSR =", np.round(tsr_ref, decimals=4))
print("Strut torque =", meantorque, "Nm at", meanrpm, "RPM")
if plot:
plt.figure()
plt.plot(time_ni, torque)
plt.xlabel("Time (s)")
plt.ylabel("Torque (Nm)")
plt.tight_layout()
plt.show()
meantorque -= zero_torque
ct = -meantorque/(0.5*rho*A*R*ref_speed**2)
cp = ct*tsr_ref
return tsr_ref, cp
In [59]:
# Calculating tare torque test matrix for experiment
def calc_rpm((tow_speed, tsr)):
omega = tsr*tow_speed/R
return omega/(2*np.pi)*60.0
save = False
lowest = (0.2, 1.0) # tow_speed, tsr
highest = (1.4, 4.0)
rpm_start = calc_rpm(lowest)
rpm_end = calc_rpm(highest)
steps = 25
rpms = np.linspace(rpm_start, rpm_end, steps)
revs = np.ones(len(rpms))*30.0
revs[0] = 4
revs[1] = 8
revs[2] = 12
revs[3] = 16
revs[4] = 20
revs[5] = 24
revs[-1] = 32
df = pd.DataFrame()
df["rpm"] = rpms
df.index.name = "run"
df["revs"] = revs
if save:
df.to_csv("Config/Test plan/Tare-torque.csv")
df["minutes"] = revs/rpms
df["samples"] = np.floor(df.minutes*60*2000)
df["samples_per_rev"] = df.samples/df.revs
print("Total time (minutes):", df.minutes.sum())
df
Out[59]: